﻿#pragma once

#include <DockWidgetInterface.h>
#include <Global.h>
#include "MessageBrowserExport.h"

namespace Domy {

class MessageToolBar;
class MessageBrowser;

/**
 * @brief The MessageBrowserWindow class
 * @note  消息窗口
 */
class MESSAGEBROWSER_EXPORT MessageBrowserWindow : public DockWidgetInterface
{
    Q_OBJECT

public:
    MessageBrowserWindow(ActionEnableCtrl ctrl, QWidget *parent);
    ~MessageBrowserWindow();

    virtual void doAction(ActionKey key) override;

    virtual QDockWidget *createDockWidget() override;

protected:
    virtual void keyPressEvent(QKeyEvent *event) override;

private slots:
    void slotOnAppendMessage(MessageType type, const QStringList &msg_list);
    void slotOnFind(const QString &text, bool is_case_sensitive, bool is_whole_word);
    void slotOnFindNext(const QString &text, bool is_case_sensitive, bool is_whole_word);
    void slotOnFindPrevious(const QString &text, bool is_case_sensitive, bool is_whole_word);
    void slotOnClearFindResult();
    void slotOnMsgActionTriggered(QAction *action);

private:
    MessageToolBar *m_msg_bar;
    MessageBrowser *m_msg_browser;
};

} // namespace Domy
